import React, { useState,useEffect, useTransition,useRef  } from 'react'
import {Button, Card,Modal,Form,message,Row,Col,Input,Upload,Select, Tabs,Tooltip,List } from 'antd'
import { useNavigate } from 'react-router-dom';
import useCacheAlive from '@/hooks/useCacheAlive'
import MemoTable from '@/components/MemoTable';
import { useTranslation } from 'react-i18next';
import { UploadOutlined,SearchOutlined  } from '@ant-design/icons';  
import {download} from '@/utils/request';
import { list1,del,add,edit,listSubstance,editSubstance,addSubstance,delSubstance} from "@/api/modules/risksub";
import { list} from "@/api/modules/inci";
import { ProFormColumnsType } from '@ant-design/pro-components'
import FullscreenLoading from '@/components/FullscreenLoading';
import { getInfo } from "@/api/login/ssoLogin";

const {TextArea} = Input;
const { Option } = Select;
const { TabPane } = Tabs; 

const RiskSub = () => {
  const navigate = useNavigate();
  const { t } = useTranslation()
  const [isModalVisible, setIsModalVisible] = useState(false); 
  const [Title, setTitle] = useState("")  
  const [form] = Form.useForm();  
  const [isModalVisible2, setIsModalVisible2] = useState(false); 
  const [Title2, setTitle2] = useState("")  
  const [form2] = Form.useForm();  
  const [fileList, setFileList] = useState([]); 
  const [filename, setFilename] = useState(""); 
  const [isView, SetisView] = useState(false)
  const [isView2, SetisView2] = useState(false)
  const [riskdistances,setRiskdistances] = useState([]); 
  const [onReloadNum, setReloadNum] = useState(0); 
  const [onReloadNum2, setReloadNum2] = useState(0); 
  const [riskSubstanceList,setRiskSubstanceList] = useState([])
  const [loading, setLoading] = useState(false); 
  const [viewStatus, setViewStatus] = useState(false); // 加载状态 


  // 使用useEffect在组件挂载时获取数据  
  useEffect(()=>{
    getInfo().then(res=>{
      console.log(res,'res')
      const data = res.data
      data.roles.forEach((item)=>{
        if(item == "Formulator"){
          setViewStatus(true)
        }
      })
    }) 
    const query = { page: 1,
      limit: 9999,
      search:null,
      orderby: "",
      order: 0,
      total: 0,
      offset: 0}
      listSubstance(query).then(res=>{
        setRiskdistances(res.data.data.page)
    })
  },[])

  const formColumns:ProFormColumnsType[] = [{
    title: t('INCI'),
    dataIndex: 'search',
    valueType: 'text', 
  }, ]

  const columns: any = [
    {
      title: t('inci.serial'),
      dataIndex: 'serial',
      key: 'serial',
      width: 60,
      fixed:'left',
    },
    {
      title: t('inci.inciCn'),
      dataIndex: 'inciCn',
      key: 'inciCn',
      ellipsis: {
        showTitle: false,
      },
      render: (inciUs) => (
        <Tooltip placement="topLeft" title={inciUs}>
          {inciUs}
        </Tooltip>
      ),
    },
    {
      title: t('inci.inciUs'),
      dataIndex: 'inciUs',
      key: 'inciUs',
      ellipsis: {
        showTitle: false,
      },
      render: (inciUs) => (
        <Tooltip placement="topLeft" title={inciUs}>
          {inciUs}
        </Tooltip>
      ),
    },
    {
      title: t('inci.inciRisksubstanceList'),
      dataIndex: 'inciRisksubstanceList',
      key: 'inciRisksubstanceList',
      render: (inciRisksubstanceList, record) => {  
        if (record.type == null) {  
          // 如果 record.type 为 null，则显示 inciRisksubstanceList 中符合条件的项  
          return (  
            <div>  
              {inciRisksubstanceList.map((i, index) => (  
                <span key={index}>  
                  {i.contain === 'YES' && (  
                    <i style={{ color: 'red' }}>{i.riskSubstance.riskCn}、</i>  
                  )}  
                </span>  
              ))}  
            </div>  
          );  
        } else {  
          return <span>{record.type}</span>; 
          
        }  
      }
    },
    {
      title: t('inci.comment1'),
      dataIndex: 'comment',
      key: 'comment',
      render: (text,record) => {  
        return <span>{record.inciRisksubstanceList[0].comment}</span>; 
      }
    },
    {  
      title: t('action'),  
      key: 'action',
      fixed:'right',
      render: (text, record) => (  
        <>  
           <Button type="link"  onClick={() => handleView(record)}>  
           {t('view')}  
          </Button> 
          {viewStatus ? null : (
            <>
              <Button type="link" onClick={() => handleEdit(record)}>  
                {t('edit')}  
                </Button>  
                <Button type="link" danger onClick={() => handleDelete(record.serial)}>  
                {t('delete')}   
                </Button>
            </>
          )}
        </>  
      ),  
    },  
  ];


  const getData = async (formData) => {
    const { success, data} = await list1({...formData, orderby: 'a.id', order: 0})
    if(!success) return false
    console.log(data)
    let list2 = data.data.page
    list2.forEach(element => {
      let flag=false;
      element.inciRisksubstanceList.forEach(i=>{
          if(i.contain=="YES"){
              flag=true
          }
      })
      if(!flag){
          element.type="该成分没有风险物质"
      }
  });
  console.log(list2,'list2')
    return {
      data: list2,
      total: data.data.total
    }
  } 

  const handleAdd = () =>{
    SetisView(false)
    form.resetFields()
    setTitle("新增/New")
    showModal()
  }

  const showModal = () => {  
    setIsModalVisible(true);  
  };  

  
  const handleOk = () => {  
    setLoading(true)
    // 调用接口添加数据，这里假设你有一个函数addFormData来处理添加逻辑  
    // const response = addFormData(newFormData);  
    // ...处理接口响应...  
    const values = form.getFieldsValue(); 
    let edit1 = false
    let inciRisks = [];
    if(Title=='修改/Edit'){
      edit1 = true 
      }
        riskdistances.map(itm => {
           let inciRisk = {
            lawInciSerial: values.lawInciSerial,
            productRisksubstanceId: itm.id,
            comment: values.comment,
            contain: 'NO',
            id:null,
        };
        if (values.risksubstanceStr.indexOf(itm.id) != -1) {
            inciRisk.contain = "YES"
        }
        if (riskSubstanceList) {
            const inc = riskSubstanceList.find(a => a.productRisksubstanceId == itm.id);
        if (inc != null) {
            inciRisk.id = inc.id
            inciRisks.push(inciRisk)
        }else{
          inciRisks.push(inciRisk)
        }
        } else {
            inciRisks.push(inciRisk)
        }
       
    })
   if (edit1 != false) {
    let data={
        inciRisks: inciRisks,
        risk: {
            id: values.id,
            comment: values.comment,
        }
      }
     edit(data).then(response => {
      if(response.data.status == 500){
        message.error(response.data.message)
      }else{
        message.success("success")
      }
      setLoading(false)
      setIsModalVisible(false);
      setReloadNum(onReloadNum+1)
     });
   } else {
      let data={
        inciRisks: inciRisks,
        risk: {
            comment: values.comment,
        }
      }
      console.log(data,'data')
      add(data).then(response => {
        if(response.data.status == 500){
          message.error(response.data.message)
        }else{
          message.success("success")
        }
        setLoading(false)
       setIsModalVisible(false);
       setReloadNum(onReloadNum+1)
     });
   } 
    // 根据需要更新formData或执行其他逻辑  
    // ...  
  };  

  const handleView = (record) =>{
    record.inciStr=(record.inciCn ? '' + record.inciCn : '') + (record.inciUs ? ' ,' + record.inciUs : '')
    record.lawInciSerial=record.serial
    record.risksubstanceStr=[]
    record.comment=record.inciRisksubstanceList[0].comment
    record.inciRisksubstanceList.map(ite => {
      if (ite.contain == "YES") {
        record.risksubstanceStr.push(ite.productRisksubstanceId)
          }
      })
   SetisView(true)
   setTitle("查看/View")
   console.log(record,'record')
   form.setFieldsValue({ ...record });  
   setIsModalVisible(true);  
  }

  const handleEdit = (record) =>{
    
    record.inciStr=(record.inciCn ? '' + record.inciCn : '') + (record.inciUs ? ' ,' + record.inciUs : '')
    record.lawInciSerial=record.serial
    record.risksubstanceStr=[]
    record.comment=record.inciRisksubstanceList[0].comment
    record.inciRisksubstanceList.map(ite => {
      if (ite.contain == "YES") {
        record.risksubstanceStr.push(ite.productRisksubstanceId)
          }
      })
    setRiskSubstanceList(record.inciRisksubstanceList)
    SetisView(false)
    setTitle("修改/Edit")
    console.log(record,'record')
    form.setFieldsValue({ ...record });  
    setIsModalVisible(true);  
    // 这里可以添加打开模态框并显示编辑表单的逻辑  
  }

  const handleDelete = (key) =>{
    let inciIds = []
    inciIds.push(key)
    Modal.confirm({  
      title: 'Confirm Delete',  
      content: 'Please confirm to DELETE SELECTED RECORDS!',  
      onOk() {  
        setLoading(true)
        del(inciIds).then(res=>{
            message.success("Success")
            setLoading(false)
            setReloadNum(onReloadNum+1)
        }) 
      },  
    }); 
  }
  
  const handleCancel = () => {  
    setIsModalVisible(false);  
  };  

  //select查询

  const [searchResult, setSearchResult] = useState([]);  
  const [visible, setVisible] = useState(false);  
  const [selectedResult, setSelectedResult] = useState(null);  
  
  const handleSearch = (values) => {  
    // 假设这里有一个异步的搜索函数，它返回搜索结果  
    const fakeSearch = async () => {  
      const inci = form.getFieldsValue()
      const data={
        page:1,
        limit:999,
        search:inci.inciStr,
    }
    list(data).then(res=>{
        let incis=res.data.data.page
        incis.map(item=>{
          item.name=(item.inciCn?''+item.inciCn:'') + (item.inciUs?' ,'+item.inciUs:'')
        })
        setSearchResult(incis);
        setVisible(true);  
    })
    };  
    fakeSearch()
  };  
  
  const handleSelectResult = (result) => {  
    form.setFieldsValue({ inciStr: result.name }); // 回填表单  
    form.setFieldsValue({lawInciSerial:result.serial})
    setSelectedResult(result);  
    setVisible(false); // 关闭弹窗  
  };  
  
  const modalFooter = [  
    <Button key="back" onClick={() => setVisible(false)}>  
      取消  
    </Button>,  
    <Button key="submit" type="primary" onClick={() => handleSelectResult(selectedResult)}>  
      选择  
    </Button>,  
  ];  

  //风险物质列表

  
  const formColumns2:ProFormColumnsType[] = [{
    title: t('risk'),
    dataIndex: 'search',
    valueType: 'text', 
  }, ]

  const columns2: any = [
    {
      title: t('inci.riskEn'),
      dataIndex: 'riskEn',
      key: 'riskEn',
      width: 120,
      fixed:'left',
      ellipsis: {
        showTitle: false,
      },
      render: (riskEn) => (
        <Tooltip placement="topLeft" title={riskEn}>
          {riskEn}
        </Tooltip>
      ),
    },
    {
      title: t('inci.riskCn'),
      dataIndex: 'riskCn',
      key: 'riskCn',
      width: 120,
      fixed:'left',
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {
      title: t('risksubstance.type'),
      dataIndex: 'type',
      key: 'type',
      width: 90,
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {
      title: t('risksubstance.maximum'),
      dataIndex: 'maximum',
      key: 'maximum',
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {
      title: t('risksubstance.testMethod'),
      dataIndex: 'testMethod',
      key: 'testMethod',
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {
      title: t('risksubstance.legalSource'),
      dataIndex: 'legalSource',
      key: 'legalSource',
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {
      title: t('risksubstance.comment'),
      dataIndex: 'comment',
      key: 'comment',
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {
      title: t('risksubstance.remarkCn'),
      dataIndex: 'remarkCn',
      key: 'remarkCn',
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {
      title: t('risksubstance.diagnosticCn'),
      dataIndex: 'diagnosticCn',
      key: 'diagnosticCn',
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {
      title: t('risksubstance.diagnosticEn'),
      dataIndex: 'diagnosticEn',
      key: 'diagnosticEn',
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {
      title: t('risksubstance.dataReference'),
      dataIndex: 'dataReference',
      key: 'dataReference',
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {
      title: t('risksubstance.filename'),
      dataIndex: 'filename',
      key: 'filename',
      ellipsis: {
        showTitle: false,
      },
      render: (value) => (
        <Tooltip placement="topLeft" title={value}>
          {value}
        </Tooltip>
      ),
    },
    {  
      title: t('action'),  
      key: 'action',
      fixed:'right',
      render: (text, record) => (  
        <>  
           <Button type="link"  onClick={() => handleView2(record)}>  
           {t('view')}  
          </Button> 
          {viewStatus ? null : (
            <>
               <Button type="link" onClick={() => handleEdit2(record)}>  
               {t('edit')}  
               </Button>  
               <Button type="link" danger onClick={() => handleDelete2(record.id)}>  
               {t('delete')}   
               </Button>  
            </>
          )}
        </>  
      ),  
    },  
  ];


  const getData2 = async (formData) => {
    const { success, data} = await listSubstance({...formData, orderby: 'id', order: 1})
    if(!success) return false
    console.log(data)
    let list2 = data.data.page
    console.log(list2,'list2')
    return {
      data: list2,
      total: data.data.total
    }
  } 

  const handleAdd2 = () =>{
    SetisView2(false)
    form2.resetFields()
    setTitle2("新增/New")
    showModal2()
  }

  const showModal2 = () => {  
    setIsModalVisible2(true);  
  };  

  
  const handleOk2 = () => { 
    setLoading(true) 
    // 调用接口添加数据，这里假设你有一个函数addFormData来处理添加逻辑  
    // const response = addFormData(newFormData);  
    // ...处理接口响应...  
    const values = form2.getFieldsValue(); 
    if(values.diagnosticCn == "" || values.diagnosticCn == null || values.diagnosticCn ==undefined){
      values.diagnosticCn=""
   }else{
      values.diagnosticCn=values.diagnosticCn.join('>>>')
   }

   if(values.comment == "" || values.comment == undefined || values.comment == null){
      values.comment=""
   }else{
      values.comment=values.comment.join('>>>')
   }
   if(values.dateReference == "" || values.dateReference == undefined || values.dateReference == null){
      values.dateReference=""
   }else{
      values.dateReference=values.dateReference.join('>>>')
   } 
    if(Title2=='新增/New'){
        //新增
        values.id =null
        addSubstance(values).then(res=>{
          setLoading(false)
            message.success("Success")
            setReloadNum2(onReloadNum2+1)
             // 假设添加成功，关闭弹窗  
            setIsModalVisible2(false);  
        }).catch(()=>{
           
        })
    }else{
        //修改
        editSubstance(values).then(res=>{
          setLoading(false)
            message.success("Success")
            setReloadNum2(onReloadNum2+1)
             // 假设添加成功，关闭弹窗  
            setIsModalVisible2(false);  
        }).catch(()=>{
       })
    }

  
    // 根据需要更新formData或执行其他逻辑  
    // ...  
  };  

  const handleView2 = (record) =>{
    if(record.diagnosticCn !==null){
      if(record.diagnosticCn == ""){
         record.diagnosticCn=[]
      }else{
         record.diagnosticCn=record.diagnosticCn.split(">>>")
      }
     }
     else{
      record.diagnosticCn=[]
     }

    if(record.comment !==null){
      if(record.comment == ""){
         record.comment=[]
      }else{
         record.comment=record.comment.split(">>>")
      }
     }
     else{
      record.comment=[]
     }

    if(record.dateReference !==null){
      if(record.dateReference == ""){
         record.dateReference=[]
      }else{
         record.dateReference=record.dateReference.split(">>>")
      }
     }
     else{
      record.dateReference=[]
     }
   SetisView2(true)
   setTitle2("查看/View")
   console.log(record,'record')
   form2.setFieldsValue({ ...record });  
   setIsModalVisible2(true);  
  }

  const handleEdit2 = (record) =>{
    if(record.diagnosticCn !==null){
      if(record.diagnosticCn == ""){
         record.diagnosticCn=[]
      }else{
         record.diagnosticCn=record.diagnosticCn.split(">>>")
      }
     }
     else{
      record.diagnosticCn=[]
     }

    if(record.comment !==null){
      if(record.comment == ""){
         record.comment=[]
      }else{
         record.comment=record.comment.split(">>>")
      }
     }
     else{
      record.comment=[]
     }

    if(record.dateReference !==null){
      if(record.dateReference == ""){
         record.dateReference=[]
      }else{
         record.dateReference=record.dateReference.split(">>>")
      }
     }
     else{
      record.dateReference=[]
     }
    SetisView2(false)
    setTitle2("修改/Edit")
    console.log(record,'record')
    form2.setFieldsValue({ ...record });  
    setIsModalVisible2(true);  
    // 这里可以添加打开模态框并显示编辑表单的逻辑  
  }

  const handleDelete2 = (key) =>{
    let inciIds = []
    inciIds.push(key)
    Modal.confirm({  
      title: 'Confirm Delete',  
      content: 'Please confirm to DELETE SELECTED RECORDS!',  
      onOk() {  
        setLoading(true)
        delSubstance(inciIds).then(res=>{
          setLoading(false)
            message.success("Success")
            setReloadNum2(onReloadNum2+1)
        }) 
      },  
    }); 
  }
  
  const handleCancel2 = () => {  
    setIsModalVisible2(false);  
  };  


  const productOption = riskdistances.map((item) => {  
    // 拼接label字符串  
    const label = item.riskCn  
      ? `riskCn：${item.riskCn}${item.riskEn ? '，riskEn：' + item.riskEn : ''}`  
      : item.riskEn  
        ? `riskEn：${item.riskEn}`  
        : ''; // 如果没有riskCn和riskEn，label将是一个空字符串  
    
    return (  
      <Option key={item.id} value={item.id}>  
        {label}  
      </Option>  
    );  
  });

  const renderOperator = <>
    <Button disabled={viewStatus} type="primary" size="small" onClick={handleAdd}>{t('add')}</Button>
  </>
    const renderOperator2 = <>
    <Button disabled={viewStatus} type="primary" size="small" onClick={handleAdd2}>{t('add')}</Button>
  </>
  
  return (
    <div> 
      <FullscreenLoading showLoading={loading} loadingTip="Loading..."/> 
      <Card>
      <Tabs type="card" defaultActiveKey="风险物质关联">  
        <TabPane tab={t('INCILinking')} key="风险物质关联">  
          <MemoTable 
            name='riskSub'
            formColumns={formColumns}
            columns={columns as any}
            rowKey='id'
            operator={renderOperator}
            getData={getData}
            refreshKey={onReloadNum}
          /> 
        </TabPane>  
        <TabPane tab={t('riskSubstance')} key="风险物质列表">  
        <MemoTable 
            name='risklist'
            formColumns={formColumns2}
            columns={columns2 as any}
            rowKey='id'
            operator={renderOperator2}
            getData={getData2}
            refreshKey={onReloadNum2}
          /> 
        </TabPane>  
      </Tabs>  
      </Card>
    

    <Modal  
          title={Title}
          visible={isModalVisible}  
          onOk={handleOk}  
          onCancel={handleCancel}  
        >  
          <Form form={form} layout="vertical">
            <Form.Item  
                name="lawInciSerial"  
                label="Serial"  
            >  
                <Input disabled/>  
            </Form.Item> 
            {/* 这里假设添加的内容也是一个对象，包含key和value */}  
            <Form.Item name="inciStr" label="INCI">  
        <Input />  
      </Form.Item>  
      <Form.Item>  
        <Button type="primary" htmlType="submit" onClick={handleSearch}>  
          根据INCI搜索  
        </Button>  
        <span style={{fontSize:'12px',color:'red',marginLeft:'10px'}}>*{t('inciSearch')}  </span>
      </Form.Item>  
      <Modal  
        title="搜索结果"  
        visible={visible}  
        onCancel={() => setVisible(false)}  
        footer={modalFooter}  
      >  
        <List  
          itemLayout="horizontal"  
          dataSource={searchResult}  
          renderItem={(item) => (  
            <List.Item  
              actions={[  
                <Button type="link" onClick={() => handleSelectResult(item)}>  
                  选择  
                </Button>,  
              ]}  
            >  
              <List.Item.Meta  
                title={<span>{item.name}</span>}  
              />  
            </List.Item>  
          )}  
        />  
      </Modal>  
            <Form.Item  
              label={t('inci.risksubstanceStr')} 
              name="risksubstanceStr" 
            >  
             <Select mode="tags">
                {productOption}  
              </Select>  
            </Form.Item>  
            <Form.Item  
              name="comment"  
              label={t('inci.comment1')}  
            >  
              <Input disabled={isView}/>  
            </Form.Item> 
          </Form>  
        </Modal>  
        <Modal  
          title={Title2}
          visible={isModalVisible2}  
          onOk={handleOk2}  
          onCancel={handleCancel2}  
        >  
          <Form form={form2} layout="vertical">
            <Form.Item  
                name="id"  
                label="id" 
                hidden 
            >  
                <Input disabled/>  
            </Form.Item> 
            {/* 这里假设添加的内容也是一个对象，包含key和value */}  
            <Form.Item  
              name="riskEn"  
              label={t('inci.riskEn')}
              rules={[{ required: true, message: '请输入风险物质英文！' }]}    
            >  
              <Input disabled={isView2}/>  
            </Form.Item>  
            <Form.Item  
              name="riskCn"  
              label={t('inci.riskCn')}
              rules={[{ required: true, message: '请输入风险物质中文！' }]}    
            >  
              <Input disabled={isView2}/>  
            </Form.Item>  
            <Form.Item  
              name="type"  
              label={t('risksubstance.type')}  
            >  
              <Input disabled={isView2}/>  
            </Form.Item>  
            <Form.Item  
              name="maximum"  
              label={t('risksubstance.maximum')}  
            >  
              <Input disabled={isView2}/>  
            </Form.Item>
            <Form.Item  
              name="testMethod"  
              label={t('risksubstance.testMethod')}  
            >  
              <Input disabled={isView2}/>  
            </Form.Item>   
            <Form.Item  
              name="legalSource"  
              label={t('risksubstance.legalSource')}  
            >  
              <Input disabled={isView2}/>  
            </Form.Item>   
            <Form.Item  
              name="comment"  
              label={t('risksubstance.comment')}  
            >  
             <Select mode="tags"  disabled={isView2}></Select>
            </Form.Item>  
            <Form.Item  
              name="diagnosticEn"  
              label={t('risksubstance.diagnosticEn')}  
            >  
               <TextArea   disabled={isView2}>    
              </TextArea>  
            </Form.Item>  
            <Form.Item  
              name="diagnosticCn"  
              label={t('risksubstance.diagnosticCn')}  
            >  
             <Select mode="tags"  disabled={isView2}></Select>
            </Form.Item> 
            <Form.Item  
              name="remarkCn"  
              label={t('risksubstance.remarkCn')}  
            >  
              <TextArea   disabled={isView2}>    
              </TextArea> 
            </Form.Item>
            <Form.Item  
              name="dateReference"  
              label={t('risksubstance.dataReference')}  
            >  
             <Select mode="tags"  disabled={isView2}></Select>
            </Form.Item>  
            <Form.Item  
              name="filename"  
              label={t('risksubstance.filename')}  
            >  
              <Input  disabled={isView2}/>  
            </Form.Item> 
          </Form>  
        </Modal> 
    </div>
  )
}
export default RiskSub
